process.env.WPSCOMIP="52.42.208.187";

const WpsCom = require("../lib/WPS.COM/wps_com");
const path = require("path");
const Login = require("../lib/WPS.COM/").Login;
const UploadHuawei = require("../lib/WPS.COM/UploadHuaweiOBS");
const AccountManager = require("../lib/WPS.COM/").AccountManager;
let wpssid = 'f30eedc9fe0f559bf0efe288048d2f97941bedca00071ea589@apse1'
let wps = new WpsCom(wpssid);

wps.GetSpecialGroupPromise.then(async o => {
  debugger
  let sg = o.data.special_group;
  debugger
  let o_list = await sg.listItemsInFolder()
  debugger

  let o_login = await Login("hujimiya@yandex.com", "wps65huji");
  // debugger
  debugger
  //测试account_manager
  let o_ac = await AccountManager.initAccountManager([{
    mail:"hujimiya@yandex.com",
    pass:"wps65huji",
    define_account_code:"yandex"
  },{
    mail:"admin@kon.hingmill.cn",
    pass:"wps65kon",
    define_account_code:"kon"
  }]);
  debugger
  let change = await o_ac.am.setWpsSid("kon",wpssid);
  debugger
  let ogetKon =  o_ac.am.get_by_account_code("kon");
  let konwps = ogetKon.data.wps;
  let konwpssg = ogetKon.data.wps_sg;
  debugger




  let item123 = o_list.data.items[0]
  item123
  // debugger
  item123
  let o_path = await wps.getPathTo(o_list.data.items[0]['id'])
  let _comment =  await sg.createComment_limit255(o_list.data.items[0].id,
    "" + Array.from(new Array(1050)).fill("1").join("") + "");
    debugger
  o_path.data.path[0].fname.id
   let o_test = await sg.app.upSingleFile_huaweiFormData(path.join(__dirname, "../.vscode/launch.json"), 0, 1,"." + Array.from(new Array(20)).fill("2").join("") + "");
  // debugger
  // o_test = await sg.app.upFolder_huaweiFormData(path.join(__dirname,"../node_modules/axios"));

  // let o_createDir = await sg.createFolder_unlimitedLength("." + Array.from(new Array(50)).fill("1").join("") + "");
  debugger
  // debugger

  if (o_login.ok) {
    let wpscom2 = o_login.data.wpscom;
    let sg2 = (await wpscom2.GetSpecialGroupPromise).data.special_group;
    let uptoken2 = await sg2.requestUploadToken("xxx");
    let o_space2 = await wpscom2.getSpaces()
  } else {
    console.log("邮箱登陆失败!", o_login.msg)
  }

  // debugger


  let get_his = await sg.getFileHistory('89289286635202');
  let down_his = await sg.getFileHistoryDownloadLinkByHistoryId(
    get_his.data.histories[1].fileid,
    get_his.data.histories[1].id
  )
  let down_new = await sg.getFileNewestVersionDownloadLink(get_his.data.histories[1].fileid)

  let uptoken = await sg.requestUploadToken("xxx");
  // debugger
  let o_up = await UploadHuawei.normalFormDataPost(path.join(__dirname, '../tmp/1.57GB.zip'),
    uptoken.data.key, uptoken.data.policy, uptoken.data.AccessKeyId, uptoken.data.signature,
    uptoken.data.upload_domain);
  // debugger
  let o_createFile = await sg.createFile_afterUploadObs_100limit(
    "Welcome to 1.57GB.zip",
    uptoken.data.key,
    o_up.data.etag,
  )
  let o_space = await wps.getSpaces()
  debugger


})

let i = require("../lib/WPS.COM").Login.loginByAccountWpsCom

WpsCom